package com.wc.AlgoOJ_homework.aloj练习赛.B_能除尽;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2024/5/8 20:27
 * @description http://43.138.190.70:8888/p/GDCPC2
 */
public class Main {
    static Scanner sc = new Scanner(System.in);
    static long a, b, x;

    public static void main(String[] args) {
        a = sc.nextLong();
        b = sc.nextLong();
        x = sc.nextLong();
        if (x == 1) {
            System.out.println(b - a + 1);
        } else {
            System.out.println(b / x - (a - 1) / x + (a == 0 ? 1 : 0));
        }
    }
}
